<template>
	<el-container>
		<el-header>

		</el-header>
		<el-main>
			<el-table :data="list" style="width: 100%">
				<el-table-column label="头像">
					<template slot-scope="scope">
						<el-image style="width: 50px; height: 50px" :src="scope.row.avatar"></el-image>
					</template>
				</el-table-column>
				<el-table-column label="昵称" prop="nickname">
				</el-table-column>
				<el-table-column label="登录时间" prop="login_time">
				</el-table-column>
				<el-table-column label="电话" prop="phone">
				</el-table-column>
				<el-table-column label="鸡蛋数" prop="egg">
				</el-table-column>
        <el-table-column label="余额" prop="egg">
        </el-table-column>
				<el-table-column label="邀请人">
					<template slot-scope="scope" v-if="scope.row.invite">
						{{scope.row.invite.nickname}}
					</template>
				</el-table-column>
			</el-table>


		</el-main>
		<el-footer>
			<el-pagination background layout="prev, pager, next" :page-size="search_form.num" :total="total"
				@current-change="current_change">
			</el-pagination>
		</el-footer>
	</el-container>
</template>

<script>
	export default {
		data() {
			return {
				search_form: {
					table: "users",
					page: 1,
					num: 5,
					where: null,
					orderBy: "login_time",
					asdes: "desc"
				},
				select: {
					uid: "-1",
				},
				type: ["鸡生蛋", "用户领取鸡蛋"],
				state: ["未领取", "已领取"],
				list: [],
				total: 0,
				users: []
			}
		},
		mounted() {
			this.get_data()
		},
		methods: {
			get_data() {
				this.$model.post("/cms/table/get", this.search_form).then(res => {
					if (res.code == 200) {
						this.list = res.data.data
						this.total = res.data.total
            console.log("data:",this.list)
					}
				})
			},

			current_change(e) {
				this.search_form.page = e
				this.get_data()
			}
		}
	}
</script>

<style>
</style>
